package jfxtras.scene.control.test;

import java.util.Calendar;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.stage.Stage;

import jfxtras.scene.control.SpinnerX;
import jfxtras.scene.control.SpinnerXDataProviderFactory;


public class SpinnerXTest1 extends Application {
	
    public static void main(String[] args) {
    	jfxtras.application.Application.prelaunch();
        launch(args);       
    }

	@Override
	public void start(Stage stage) {
		
		GridPane lGridPane = new GridPane();
		ColumnConstraints column1 = new ColumnConstraints(10, 10, Double.MAX_VALUE);
		column1.setHgrow(Priority.ALWAYS);
		lGridPane.getColumnConstraints().addAll(column1);
		
		int lRowIdx = 0;
		
        // add a node
		{
			SpinnerX<String> lXSpinner1 = new SpinnerX<String>(SpinnerXDataProviderFactory.list("a", "b", "c"), "a").withCyclic(Boolean.TRUE);
			lGridPane.add(lXSpinner1, 0, lRowIdx++);
		}
		{
			SpinnerX<Integer> lXSpinner2 = new SpinnerX<Integer>(SpinnerXDataProviderFactory.integerRange(), Calendar.getInstance().get(Calendar.YEAR));
			lGridPane.add(lXSpinner2, 0, lRowIdx++);
		}

        // create scene
        Scene scene = new Scene(lGridPane, 100, 300);
        
        // create stage
        stage.setTitle("SpinnerX");
        stage.setScene(scene);
        stage.show();
    }
}
